package com.yanqu.road.server.manager.activity.commonsupport.handler;

import com.yanqu.road.logic.helper.UnionActivityGroupHelper;
import com.yanqu.road.server.manager.activity.seacraftsouthsea.SeacraftSouthSeaActivity;
import com.yanqu.road.server.manager.activity.seacraftsouthsea.SeacraftSouthSeaMgr;
import com.yanqu.road.server.manager.activity.seacraftsouthsea.SeacraftSouthSeaUnionInfo;
import com.yanqu.road.server.manager.union.activitygroup.Cross2UnionActivityGroupMgr;

/**
 * 上海争霸
 */
public class SeacraftActivitySupportHandler extends SupportActivityHandler {

    @Override
    public boolean ableUnion(int activityId, int groupId, String unionUid) {
        SeacraftSouthSeaActivity activity = SeacraftSouthSeaMgr.getSeacraftSouthSeaActivity(activityId, groupId, false);
        if(activity != null){
            SeacraftSouthSeaUnionInfo unionInfo = activity.getUnionInfo(unionUid, false);
            if(unionInfo != null){
                return true;
            }
        }
        return false;
    }

    @Override
    public boolean ableUser(int activityId, int groupId, long userId) {
        if(groupId == 0){
            return true;
        }
        int gid = Cross2UnionActivityGroupMgr.getGroupId(activityId, userId);
        return gid != UnionActivityGroupHelper.NO_GROUP_ID;
    }
}
